home *** CD-ROM | disk | FTP | other *** search
- //============================================================
- // WinCmd program to fix problems with WinWord
- //
- // Copyright (c) 1993 Douglas Boling
- //============================================================
- //
- // Check to see if Word already running. If so,
- // just switch to Word Window and exit
- //
- handle = checkrunning ("Microsoft Word")
- if (handle) do
- appactivate (getwindowtext (handle))
- exit
- end
-
- //
- // Launch Word and wait .5 seconds
- //
- "winword.exe"
- delay (500)
-
- //
- // Attempt to get handle to Word's main window. If
- // we can't quit.
- //
- handle = CheckRunning ("Microsoft Word")
- if (handle == 0)
- exit
-
- //
- // Move and size window to my specs
- //
- MoveWindow (handle, 200, 15)
- SizeWindow (handle, 800, 720)
- exit
-
- //------------------------------------------------------------
- // CheckRunning - A routine that scans all windows to see
- // if a window has a partial matching title text
- //------------------------------------------------------------
- checkrunning:
- //
- // Get first window in window list
- //
- handle = getwindow (hmain, 0)
- //
- // Loop until no more windows
- //
- while (handle <> 0) do
- //
- // Get window text
- //
- text = getwindowtext (handle)
- //
- // If the first part of the window text matches the
- // argument passed to CheckRunning return handle
- //
- if (substr (text, 0, length(arg(1))) == arg(1))
- return handle
- //
- // Get next window handle in window list
- //
- handle = getwindow (handle, 2)
- end
- //
- // No matching window found, return 0
- //
- return 0
-
-